#pragma once
#include "ResourceManager.hpp"
#include <sfml/Graphics.hpp>

//Image Manager
class ImageManager : public ResourceManager<sf::Image, std::string, 256> 
{
protected:
	bool Load(sf::Image &resource, const std::string &path) const 
	{ 
		if (!resource.LoadFromFile(path))
		{
			//Error loading, use error texture ( 16x16 red).
			//printf("Error loading %s\n",path.substr(path.find_last_of('\\')+1).c_str());
			sf::Image* errorImg = new sf::Image();
			errorImg->Create(16,16,sf::Color::Red);

			resource = *errorImg;
			return true;
		}
		else
		{
			//otherwise it loaded fine.
			printf("Loaded %s\n",path.substr(path.find_last_of('\\')+1).c_str());
			return true;
		}
	} 

};

typedef Resource<sf::Image, std::string, 256> ImageResource; 